package com.busdepot.webapp.domain;

import com.imcparts.schema.LimitedProductInformationType;
import com.imcparts.schema.ProductInformationType;

public class ImcPart extends AbstractPart {
	private String nonFitmentNotes;
	private String image;
	private String fullImage;
	private boolean oversize; // IMC data provides 0 or 1
	private String packsize;
	private String qtyRequired;
	private String remark1;
	private String remark2;
	private String inventory01;
	private String inventory07;
	private String ImcNumber;

	public static ImcPart create(ProductInformationType productInfo) {
		ImcPart part = new ImcPart();
		double markup = 1.10; // sets the mark up rate from wholesale price to
								// retail price
		// TODO FIXME temporarily hard coded mark up rate \ Ron should be able
		// to adjust this
		Double price = Double.parseDouble(productInfo.getPrice());

		part.setPrice(price * markup); // supplier cost marked up to retail
										// price displayed to customer
		part.setBrand(productInfo.getBrand());
		part.setCore(Double.parseDouble(productInfo.getCoreCharge()));
		part.setCost(Double.parseDouble(productInfo.getPrice())); // cost is
																	// supplier
																	// cost
		part.setDescription(productInfo.getPartDescription());
		part.setFullImage(productInfo.getFullImage());
		part.setImage(productInfo.getImage());
		part.setImcNumber(productInfo.getIMCPartNumber());
		part.setListPrice(Double.parseDouble(productInfo.getListPrice())); // list
																			// price
																			// is
																			// suggested
																			// retail
		part.setName(productInfo.getPartName());
		part.setWeight(Double.parseDouble(productInfo.getWeight()));
		part.setNonFitmentNotes(productInfo.getNonfitmentNotes());
		part.setPacksize(productInfo.getPackSize());
		part.setQtyRequired(productInfo.getQtyRequired());
		part.setRemark1(productInfo.getRemark1());
		part.setRemark2(productInfo.getRemark2());
		part.setInventory01(productInfo.getInventory01());
		part.setInventory07(productInfo.getInventory07());
		part.setVendorId(1); // generic IMC vendor code per Ron's database
		if (productInfo.getOversize().contains("0")) {
			part.setOversize(false);
		} else if (productInfo.getOversize().contains("1")) {
			part.setOversize(true);
		}

		return part;
	}

	public static ImcPart create(LimitedProductInformationType productInfo) {
		ImcPart part = new ImcPart();
		double markup = 1.10; // sets the mark up rate from wholesale price to
								// retail price
		// TODO FIXME temporarily hard coded mark up rate \ Ron should be able
		// to adjust this
		Double price = Double.parseDouble(productInfo.getPrice());

		part.setPrice(price * markup); // supplier cost marked up to retail
										// price displayed to customer
		part.setBrand(productInfo.getBrand());
		part.setCore(Double.parseDouble(productInfo.getCoreCharge()));
		part.setCost(Double.parseDouble(productInfo.getPrice())); // cost is
																	// supplier
																	// cost
		part.setDescription(productInfo.getPartDescription());
		part.setFullImage(productInfo.getFullImage());
		part.setImage(productInfo.getImage());
		part.setImcNumber(productInfo.getIMCPartNumber());
		part.setListPrice(Double.parseDouble(productInfo.getListPrice())); // list
																			// price
																			// is
																			// suggested
																			// retail
		part.setName(productInfo.getPartName());
		part.setWeight(Double.parseDouble(productInfo.getWeight()));
		part.setNonFitmentNotes(productInfo.getNonfitmentNotes());
		part.setPacksize(productInfo.getPackSize());
		part.setQtyRequired(productInfo.getQtyRequired());
		part.setInventory01(productInfo.getInventory01());
		part.setInventory07(productInfo.getInventory07());
		part.setVendorId(1); // generic IMC vendor code per Ron's database
		if (productInfo.getOversize().contains("0")) {
			part.setOversize(false);
		} else if (productInfo.getOversize().contains("1")) {
			part.setOversize(true);
		}

		return part;
	}

	public String getNonFitmentNotes() {
		return nonFitmentNotes;
	}

	public void setNonFitmentNotes(String nonFitmentNotes) {
		this.nonFitmentNotes = nonFitmentNotes;
	}

	public String getImage() {
		return image;
	}

	public void setImage(String image) {
		this.image = image;
	}

	public String getFullImage() {
		return fullImage;
	}

	public void setFullImage(String fullImage) {
		this.fullImage = fullImage;
	}

	public boolean isOversize() {
		return oversize;
	}

	public void setOversize(boolean oversize) {
		this.oversize = oversize;
	}

	public String getPacksize() {
		return packsize;
	}

	public void setPacksize(String packsize) {
		this.packsize = packsize;
	}

	public String getQtyRequired() {
		return qtyRequired;
	}

	public void setQtyRequired(String qtyRequired) {
		this.qtyRequired = qtyRequired;
	}

	public String getRemark1() {
		return remark1;
	}

	public void setRemark1(String remark1) {
		this.remark1 = remark1;
	}

	public String getRemark2() {
		return remark2;
	}

	public void setRemark2(String remark2) {
		this.remark2 = remark2;
	}

	public String getInventory01() {
		return inventory01;
	}

	public void setInventory01(String inventory01) {
		this.inventory01 = inventory01;
	}

	public String getInventory07() {
		return inventory07;
	}

	public void setInventory07(String inventory07) {
		this.inventory07 = inventory07;
	}

	public String getImcNumber() {
		return ImcNumber;
	}

	public void setImcNumber(String imcNumber) {
		ImcNumber = imcNumber;
	}

}
